package cn.portx.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.bstek.bdf3.dorado.jpa.annotation.Generator;
import com.bstek.dorado.annotation.PropertyDef;

import cn.portx.annotation.ChineseField;
import cn.portx.policy.ChineseToCodeGeneratorPolicy;
import cn.portx.policy.CreateUserPolicy;
import cn.portx.policy.CreatedDatePolicy;
import cn.portx.policy.IdGeneratorPolicy;

/**
 * Model class of 码头.
 * 
 * @author generated by ERMaster
 * @version $Id$
 */
@Entity
@Table(name = "T_WHARF")
public class Wharf extends BaseEntity {

	/** serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** 名称. */
	@Column(name = "NAME_", length = 100)
	@PropertyDef(label = "名称", description = "名称:名称")
	private String name;

	/** 代码. */
	@Column(name = "CODE_", length = 60)
	@ChineseField("name")
	@Generator(policy = ChineseToCodeGeneratorPolicy.class)
	@PropertyDef(label = "代码", description = "代码:代码")
	private String code;

	/** 所属港口ID. */
	@Column(name = "PORT_ID_", length = 60)
	@PropertyDef(label = "所属港口ID", description = "所属港口ID:所属港口ID")
	private String portId;

	@Transient
	private Port port;

	/** 免堆期. */
	@Column(name = "MDQ_", precision = 3, scale = 0)
	@PropertyDef(label = "免堆期", description = "免堆期:免堆期")
	private Integer mdq;

	/**
	 * Constructor.
	 */
	public Wharf() {
	}

	/**
	 * Set the 名称.
	 * 
	 * @param name
	 *            名称
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Get the 名称.
	 * 
	 * @return 名称
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Set the 代码.
	 * 
	 * @param code
	 *            代码
	 */
	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * Get the 代码.
	 * 
	 * @return 代码
	 */
	public String getCode() {
		return this.code;
	}

	/**
	 * Set the 所属港口ID.
	 * 
	 * @param portId
	 *            所属港口ID
	 */
	public void setPortId(String portId) {
		this.portId = portId;
	}

	/**
	 * Get the 所属港口ID.
	 * 
	 * @return 所属港口ID
	 */
	public String getPortId() {
		return this.portId;
	}

	public Port getPort() {
		return port;
	}

	public void setPort(Port port) {
		this.port = port;
	}

	/**
	 * Set the 免堆期.
	 * 
	 * @param mdq
	 *            免堆期
	 */
	public void setMdq(Integer mdq) {
		this.mdq = mdq;
	}

	/**
	 * Get the 免堆期.
	 * 
	 * @return 免堆期
	 */
	public Integer getMdq() {
		return this.mdq;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
		return result;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Wharf other = (Wharf) obj;
		if (this.getId() == null) {
			if (other.getId() != null) {
				return false;
			}
		} else if (!this.getId().equals(other.getId())) {
			return false;
		}
		return true;
	}

}
